<html>

<head>
	<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/media/css/base.css">
	<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/media/css/list.css">
	<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/media/css/flexyclassperm.css">
	<script type="text/javascript" src="{{MEDIA_URL}}/media/js/jquery.js"></script>
	<script type="text/javascript" src="{{MEDIA_URL}}/media/js/sysmodel/usergroup/view.js"></script>
</head>

<body>
	{% include "sysmodel/header.html" %}
	
	<div class="breadcrumbs">
		<a href="/sysmodel/home/">Home</a> &gt;
		<a href="/sysmodel/usergroup/home/">{{ug.name}}</a> &gt;
		List of FlexyClass Permission
	</div>
	
	<form enctype="multipart/form-data" action="/sysmodel/usergroup/view/{{ug.id}}/" method="post">
		<div style="display:none">{% csrf_token %}</div>
		<table class="list-container" cellspacing="0">
			<tbody id="UI_CLASS_LIST">
				<tr>
					<td class="list-heading">	
						<h3>List of FlexyClass Permissions</h3>
					</td>
					<td class="list-tools"></td>
				</tr>
			</tbody>
		</table>
	</form>
	
	<div class="hidden">
		<ul id="DB_CLASS_LIST">
			{% for fc in flexyclasses %}
				<li flexyclass_id="{{fc.id}}">{{fc.name}}</li>	
			{% endfor %}
		</ul>
		<hr>
		<ul id="DB_GROUP_LIST">
			{% for g in groups %}
				<li group_id="{{g.id}}" flexyclass_id="{{g.flexyclass.id}}">{{g.name}}</li>
			{% endfor %}
		</ul>
		<hr>
		<ul id="DB_FIELD_LIST">
			{% for f in fields %}
				{% if f.extra_field_parent == None %}
					<li field_id="{{f.id}}" group_id="{{f.group.id}}" class_id="{{f.flexyclass.id}}"
					fieldtype=
					"{{f.type}}{% if f.type == "NTO1" or f.type == "NTOM" %} [{{ f.sel_field.flexyclass.name }} &gt; {{ f.sel_field.name }}]
					{% endif %}">{{f.name}}</li>
				{% endif %}
			{% endfor %}
		</ul>
		
		<hr>
		<ul id="DB_DISPLAY_FIELD_LIST">
			{% for f in fields %}
				{% if f.type == 'NTO1' or f.type == 'NTOM' %}
					{% for df in f.display_fields.all %}
						<li parent_field_id="{{ f.id }}" self_field_id="{{ df.id }}">{{ df.name }}</li>
					{% endfor %}
				{% endif %}
			{% endfor %}
		</ul>
		
		<hr>
		<ul id="DB_EXTRA_FIELD_LIST">
			{% for f in fields %}
				{% if f.extra_field_parent != None %}
					<li self_field_id="{{f.id}}" fieldtype="{{f.type}}"  class_id="{{f.flexyclass.id}}"
						parent_field_id="{{ f.extra_field_parent.id }}">{{f.name}}</li>
				{% endif %}
			{% endfor %}
		</ul>
		
		<ul id="CLASS_PERM_LIST">
			{% for ugc in usergroup_flexyclass %}
				<li class_id="{{ugc.flexyclass.id}}">{{ugc.perm}}</li>
			{% endfor %}
		</ul>
		<ul id="FIELD_PERM_LIST">
			{% for ugf in usergroup_field %}
				<li field_id="{{ugf.field.id}}">{{ugf.perm}}</li>
			{% endfor %}
		</ul>
	</div>
</body>
</html>
